﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:Converters="clr-namespace:Alma.Converters;assembly=Alma.Converters"
                    xmlns:UX="clr-namespace:Alma.UX" >

    <Converters:BooleanToHiddenOrVisibleConverter x:Key="BooleanToHiddenOrVisibleConverter"/>
    <Converters:BorderClipConverter x:Key="ContentClipConverter"/>
    <Converters:RoundTextClipConverter x:Key="RoundTextClipConverter"/>
    <Converters:HeightToRoundCornerRadiusConverter x:Key="HeightToRoundCornerRadiusConverter"/>

    <Style TargetType="UX:UXCloseBox">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="UX:UXCloseBox">
                    <Canvas Width="20" Height="20" Margin="2">
                        <Canvas.Clip>
                            <RectangleGeometry Rect="0,0,20,20"/>
                        </Canvas.Clip>
                        <Image x:Name="img" Canvas.Top="0" Source="/Alma.Assets;Component/Images/CloseTrafficButton.tiff" Width="20" Height="60"/>
                    </Canvas>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter Property="Canvas.Top" Value="-20" TargetName="img"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="UX:UXMinimizeBox">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="UX:UXMinimizeBox">
                    <Canvas Width="20" Height="20" Margin="2">
                        <Canvas.Clip>
                            <RectangleGeometry Rect="0,0,20,20"/>
                        </Canvas.Clip>
                        <Image x:Name="img" Canvas.Top="0" Source="/Alma.Assets;Component/Images/MinimizeTrafficButton.tiff" Width="20" Height="60"/>
                    </Canvas>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter Property="Canvas.Top" Value="-20" TargetName="img"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="UX:UXMaximizeBox">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="UX:UXMaximizeBox">
                    <Canvas Width="20" Height="20" Margin="2">
                        <Canvas.Clip>
                            <RectangleGeometry Rect="0,0,20,20"/>
                        </Canvas.Clip>
                        <Image x:Name="img" Canvas.Top="0" Source="/Alma.Assets;Component/Images/ZoomTrafficButton.tiff" Width="20" Height="60"/>
                    </Canvas>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter Property="Canvas.Top" Value="-20" TargetName="img"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="UX:UXWindowHeader">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="UX:UXWindowHeader">
                    <Grid>
                        <Border Grid.ColumnSpan="3" CornerRadius="5,5,0,0">
                            <Border.Background>
                                <ImageBrush ImageSource="/Alma.Assets;Component/Images/TitleBarBGLeft.png" TileMode="Tile" Stretch="Uniform" ViewportUnits="Absolute" Viewport="0,0,25,42"/>
                            </Border.Background>
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <Style TargetType="UX:UXBackgrid">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="UX:UXBackgrid">
                    <Grid>
                        <Grid.Effect>
                            <DropShadowEffect BlurRadius="10" ShadowDepth="0"/>
                        </Grid.Effect>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="180"/>
                            <RowDefinition />
                            <RowDefinition Height="55"/>
                            <RowDefinition Height="20"/>
                        </Grid.RowDefinitions>

                        <Border CornerRadius="5,5,0,0">
                            <Border.Background>
                                <ImageBrush TileMode="Tile" ImageSource="/Alma.Assets;Component/Images/LockedShutterBackground.png" Stretch="UniformToFill" ViewportUnits="Absolute" Viewport="0,0,150,180"/>
                            </Border.Background>
                        </Border>

                        <Border CornerRadius="0,0,5,5" Grid.Row="1" Grid.RowSpan="2">
                            <Border.Background>
                                <ImageBrush TileMode="Tile" ImageSource="/Alma.Assets;Component/Images/LockedShutterBackgroundPattern.png" Stretch="UniformToFill" ViewportUnits="Absolute" Viewport="0,0,175,154"/>
                            </Border.Background>
                        </Border>
                        <Border CornerRadius="0,0,5,5" Grid.Row="2">
                            <Border.Background>
                                <ImageBrush TileMode="Tile" ImageSource="/Alma.Assets;Component/Images/SlidingViewBackground.png" Stretch="UniformToFill" ViewportUnits="Absolute" Viewport="0,0,50,55"/>
                            </Border.Background>
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <Style TargetType="UX:UXTurbine">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="UX:UXTurbine">
                    <Grid Width="100" Height="100">
                        <Grid.Background>
                            <ImageBrush ImageSource="/Alma.Assets;Component/Images/UBBackground.tiff"/>
                        </Grid.Background>
                        <Image Source="/Alma.Assets;Component/Images/UBTurbine.tiff" Margin="8"/>
                        <Grid x:Name="grid" Margin="10">
                            <Grid.Background>
                                <ImageBrush ImageSource="/Alma.Assets;Component/Images/UBButton.tiff"/>
                            </Grid.Background>
                            <ContentPresenter ContentSource="Content" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                        </Grid>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter Property="Background" TargetName="grid">
                                <Setter.Value>
                                    <ImageBrush ImageSource="/Alma.Assets;Component/Images/UBButtonPressed.tiff"/>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <Style TargetType="UX:UXSeparatorHorizontal">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="UX:UXSeparatorHorizontal">
                    <Image Source="/Alma.Assets;Component/Images/StatisticsSeparatorHorizontal.png"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <Style TargetType="UX:UXBigSeparator">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="UX:UXBigSeparator">
                    <Image Source="/Alma.Assets;Component/Images/HelpSeparator.png"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <Style TargetType="UX:ListBoxItemWithIcon">
        <Setter Property="Foreground" Value="LightGray"/>
        <Setter Property="FontSize" Value="20"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="UX:ListBoxItemWithIcon">
                    <Grid Height="54" Width="245">
                        <Border Background="White" Opacity="0"/>
                        <Image Source="/Alma.Assets;Component/Images/ModulesListSelection.png" Visibility="{Binding IsSelected, Converter={StaticResource BooleanToHiddenOrVisibleConverter}, RelativeSource={RelativeSource TemplatedParent}}"/>
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="auto"/>
                                <ColumnDefinition/>
                            </Grid.ColumnDefinitions>
                            <Image Source="{TemplateBinding Icon}" Width="30" Height="30" Margin="10,0,0,0" VerticalAlignment="Center"/>
                            <ContentPresenter ContentSource="Content" VerticalAlignment="Center" Margin="10" HorizontalAlignment="Stretch" Grid.Column="1"/>
                        </Grid>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <Style TargetType="UX:UXButton">
        <Setter Property="Foreground" Value="LightGray"/>
        <Setter Property="FontSize" Value="15"/>
        <Setter Property="Height" Value="36"/>
        <Setter Property="Width" Value="97"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="UX:UXButton">
                    <Grid>
                        <Border Name="bdr" CornerRadius="{TemplateBinding CornerRadius}">
                            <Border.Background>
                                <ImageBrush ImageSource="/Alma.Assets;Component/Images/ButtonBackgroundImages/ButtonBlackBackground.png" TileMode="Tile" Stretch="Uniform" ViewportUnits="Absolute" Viewport="0,0,97,36"/>
                            </Border.Background>
                        </Border>
                        <ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center" ContentSource="Content"/>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter Property="Background" TargetName="bdr">
                                <Setter.Value>
                                    <ImageBrush ImageSource="/Alma.Assets;Component/Images/ButtonBackgroundImages/ButtonWhiteBackground.png" TileMode="Tile" Stretch="Uniform" ViewportUnits="Absolute" Viewport="0,0,97,36"/>
                                </Setter.Value>
                            </Setter>
                            <Setter Property="Foreground" Value="Gray"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <Style TargetType="UX:UXTextField">
        <Setter Property="Padding" Value="3" />
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="Foreground" Value="LightGray"/>
        <Setter Property="FontSize" Value="14"/>
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="UX:UXTextField">
                    <Grid>
                        <Border>
                            <Border.Background>
                                <ImageBrush TileMode="Tile" ImageSource="/Alma.Assets;Component/Images/LockedShutterBackgroundPattern.png" Stretch="UniformToFill" ViewportUnits="Absolute" Viewport="0,0,175,154"/>
                            </Border.Background>
                        </Border>

                        <Border BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="{TemplateBinding CornerRadius}" ClipToBounds="True">
                            <Border.BorderBrush>
                                <ImageBrush TileMode="Tile" ImageSource="/Alma.Assets;Component/Images/LockedShutterBackgroundPattern.png" Stretch="UniformToFill" ViewportUnits="Absolute" Viewport="0,0,175,154"/>
                            </Border.BorderBrush>
                            <Border.Effect>
                                <DropShadowEffect ShadowDepth="0"/>
                            </Border.Effect>
                            <Border.Clip>
                                <MultiBinding Converter="{StaticResource ContentClipConverter}">
                                    <Binding Path="ActualWidth" RelativeSource="{RelativeSource Self}"/>
                                    <Binding Path="ActualHeight" RelativeSource="{RelativeSource Self}"/>
                                    <Binding Path="CornerRadius" RelativeSource="{RelativeSource Self}"/>
                                </MultiBinding>
                            </Border.Clip>
                        </Border>
                        
                        <Border Padding="{TemplateBinding Padding}" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" Margin="{TemplateBinding Margin}">
                            <ScrollViewer Margin="0" x:Name="PART_ContentHost" BorderThickness="0" CanContentScroll="{TemplateBinding ScrollViewer.CanContentScroll}" />
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <Style TargetType="UX:UXRoundTextField">
        <Setter Property="Foreground" Value="LightGray"/>
        <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Disabled"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="UX:UXRoundTextField">
                    <Border Height="{TemplateBinding Height}" Width="{TemplateBinding Width}" >
                        <Border.Background>
                            <ImageBrush ImageSource="/Alma.Assets;Component/Images/tab_bg_texture.png" TileMode="Tile" ViewportUnits="Absolute" Viewport="0,0,256,256"/>
                        </Border.Background>
                        <Border.Clip>
                            <MultiBinding Converter="{StaticResource RoundTextClipConverter}">
                                <Binding Path="ActualWidth" RelativeSource="{RelativeSource Self}"/>
                                <Binding Path="ActualHeight" RelativeSource="{RelativeSource Self}"/>
                            </MultiBinding>
                        </Border.Clip>
                        <Border BorderBrush="White" BorderThickness="1" Padding="10,5">
                            <Border.CornerRadius>
                                <Binding Path="ActualHeight" RelativeSource="{RelativeSource Self}" Converter="{StaticResource HeightToRoundCornerRadiusConverter}"/>
                            </Border.CornerRadius>
                            <Border.Effect>
                                <DropShadowEffect BlurRadius="10" ShadowDepth="2"/>
                            </Border.Effect>
                            <ScrollViewer Margin="0" x:Name="PART_ContentHost" BorderThickness="0" CanContentScroll="{TemplateBinding ScrollViewer.CanContentScroll}" />
                        </Border>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <Style TargetType="UX:UXPeople">
        <Setter Property="Margin" Value="10"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="UX:UXPeople">
                    <Grid Margin="{TemplateBinding Margin}">
                        <Grid.RowDefinitions>
                            <RowDefinition/>
                            <RowDefinition Height="auto"/>
                        </Grid.RowDefinitions>
                        <Image Width="90" Height="90" Source="{TemplateBinding Image}" Stretch="UniformToFill" Margin="5">
                            <Image.Clip>
                                <EllipseGeometry RadiusX="45" RadiusY="45" Center="45,45" />
                            </Image.Clip>
                        </Image>
                        <Border Name="bdr">
                            <Border.Background>
                                <ImageBrush ImageSource="/Alma.Assets;Component/Images/HeadMask.fw.png"/>
                            </Border.Background>
                            <Border.Clip>
                                <EllipseGeometry RadiusX="50" RadiusY="50" Center="50,50" />
                            </Border.Clip>
                        </Border>
                        <TextBlock Text="{TemplateBinding DisplayName}" Grid.Row="1" HorizontalAlignment="Center" Margin="0,5" TextWrapping="Wrap"  />
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter Property="Background" TargetName="bdr">
                                <Setter.Value>
                                    <ImageBrush ImageSource="/Alma.Assets;Component/Images/HeadMask.Hover.fw.png"/>
                                </Setter.Value>
                            </Setter>
                            <Setter Property="Foreground" Value="White"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>